form,
.form {
  margin: 0;
  font-size: $tx5;

  label {
    line-height: $formElementHeight;
    font-weight: 500;
    -webkit-user-select: none;
    display: flex;
    align-items: center;
    word-wrap: break-word;
    hyphens: auto;
  }

  &.compact label {
    line-height: $formElementHeight * 0.75;
  }

  &.veryCompact label {
    line-height: $formElementHeight * 0.5;
  }
}

input::-webkit-input-placeholder,
select::-webkit-input-placeholder,
textarea::-webkit-input-placeholder,
.txPlaceholder {
  // use txPlaceholder for non-placeholder text that needs to match the placeholder style
  color: inherit;
  opacity: 0.35;
}

input,
select,
textarea,
.trumbowyg-editor {
  border: none;
  outline: none;
  outline-color: transparent;
  background: none;
  color: inherit;
  border-radius: 3px;
  font: {
    family: "Noto Sans", sans-serif;
    size: $tx5;
  }
}

input[type=reset] {
  cursor: pointer;

  &:hover {
    text-decoration: underline;
  }
}

.trumbowyg-editor {
  border-radius: 0;
}

.trumbowyg textarea {
  display: none;
}

.select2-container--focus .select2-selection__rendered,
.select2Tags + .select2-container .select2-container--default .select2-selection--multiple .select2-selection__rendered,
.select2-container--focus .select2-selection {
  outline: none;
}

select {
  width: 100%;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="url"],
textarea,
.select2-container--focus .select2-selection__rendered,
.select2Tags + .select2-container .select2-container--default .select2-selection--multiple .select2-selection__rendered,
.trumbowyg-editor {
  border-style: solid;
  border-width: 1px;
  //use the color class to set the border color
  width: 100%;
  box-sizing: border-box;
  padding: 0 $pad;
  line-height: $inputHeight;

  &.btnHeight {
    // use to make form elements match the size of a button
    line-height: $buttonHeight;
    height: $buttonHeight;
  }

  form.compact &,
  .form.compact & {
    line-height: $formElementHeight * 0.75;
  }

  form.veryCompact &,
  .form.veryCompact & {
    line-height: $formElementHeight * 0.5;
  }
}

.trumbowyg-editor {
  line-height: 1.2em;
}

//input[type="number"].noSpin::-webkit-outer-spin-button,
input[type="number"].noSpin::-webkit-inner-spin-button {
  display:none;
}

// TODO: style the spin buttons on normal number inputs

.inputPercentWrapper {
  border-radius: 3px;
  border-style: solid;
  border-width: 1px;
  display: inline-block;

  input {
    border-radius: 0;
    border: none;
    box-shadow: none;
    width: calc(100% - 1.5em);
    padding-right: 0;

    &::-webkit-outer-spin-button,
    &::-webkit-inner-spin-button {
      display:none;
    }
  }

  &:after {
    content: "%";
    display: inline-block;
  }
}

.select2-container--default.select2-container--focus .select2-selection {
  border: none;
}

textarea {
  background: none;
  outline: none;
  -webkit-appearance: none;
  resize: none;
  line-height: 1.2em;
  padding: $pad;
  overflow: hidden;

  &:focus {
    overflow: auto;
  }

  &.resizable {
    resize: vertical;
  }
}

.errorList {
  color: $error;
  word-wrap: break-word;
  hyphens: auto;

  li {
    i {
      margin-right: 5px;
    }

    margin-bottom: 5px;
  }

  margin-bottom: 10px;
}

label {
  &.error {
    input, textarea {
      border: 1px solid red;
    }
  }
}

.required {
  display: inline-flex;

  &::after {
    content: '*';
    font-size: 130%;
  }
}

// By default, using width values appropriate for currency codes.
// Overwrite in your own implementation if you need to deviate.
.inputSelect {
  position: relative;

  input {
    padding-right: 75px;
  }

  .select2-container {
    width: 70px !important;
    position: absolute;
    right: 1px;
    top: 1px;

    .select2-selection {
      border-width: 0;
    }
  }

  &::after {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    right: 71px;
    width: 1px;
    background-color: #DDD;
  }
}

input[type="radio"]:checked + label {
  font-weight: 700;
}

input[type="checkbox"] {
  display: none;

  & + label {
    display: flex;
    align-items: baseline;
    cursor: pointer;

    &:before {
      content: "\f372";
      font-family: Ionicons;
      line-height:inherit;
      font-size: 1.5em;
      position: relative;
      top: 0.15em;
      margin-right: 0.25em;

      .flexVCent & {
        top: 0; // don't adjust position if it's flex centered
      }
    }
  }

  &:checked + label:before {
    content: "\f373";
  }

  &.centerLabel + label {
    align-items: center;

    &:before {
      top: 0;
    }
  }
}
